package client02;

/**
 * @author yd
 * @date 2021/3/21 11:34
 */
public class Singleton4 {

    private static Singleton4 singleton;

    private Singleton4() {
    }
    public static Singleton4 getInstance() {
        if (singleton == null) {
            singleton = new Singleton4();
        }
        return singleton;
    }

    public static void main(String[] args) {
        Singleton4 singleton1 = Singleton4.getInstance();
        Singleton4 singleton2 = Singleton4.getInstance();
        System.out.println(singleton1==singleton2);
    }
}
